package com.kongyz.filter;

import com.kongyz.Person;

import java.util.List;

/**
 * @author kongyz
 * @date 2018/6/27 21:59
 * @Description:
 */
public class AndCriteria implements Criteria {
    private Criteria criteria;
    private Criteria otherCriteria;

    public AndCriteria(Criteria criteria, Criteria otherCriteria) {
        this.criteria = criteria;
        this.otherCriteria = otherCriteria;
    }

    public List<Person> meetCriteria(List<Person> personList) {
        List<Person> firstCriteriaPersions=criteria.meetCriteria(personList);
        return otherCriteria.meetCriteria(firstCriteriaPersions);
    }
}
